package node.exp;

import grammar.Lexer;
import node.Node;
import symbol.SymbolTable;

public class Exp implements Node {
    private final Lexer lexer;
    private final SymbolTable table;
    private final Node father;
    private AddExp addExp;

    public Exp(Lexer lexer, SymbolTable table, Node father) {
        this.lexer = lexer;
        this.table = table;
        this.father = father;
        parseExp();
    }

    private void parseExp() {
        addExp = new AddExp(lexer, table, this);
    }

    public int getValue() {
        return addExp.getValue();
    }

    @Override
    public Node getFather() {
        return father;
    }

    @Override
    public String toString() {
        return addExp.toString() + "<Exp>\n";
    }

    @Override
    public String genMidCode() {
        return addExp.genMidCode();
    }
}

